﻿using System.Text;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.Collections;

/// <summary>
/// Summary description for clsKetNoi
/// </summary>
public class clsKetNoi
{
    SqlConnection m_SQLKetNoi;

    public SqlConnection SQLKetNoi
    {
        get { return m_SQLKetNoi; }
        set { m_SQLKetNoi = value; }
    }

    public clsKetNoi()
    {
        //
        // TODO: Add constructor logic here
        //
        //string m_strChuoiKetNoi = @"Data Source=.;Initial Catalog=QLDauSach;User ID=sa;Password=123456";
        string m_strChuoiKetNoi = "Data Source=.;Initial Catalog=QuanLyNhaSach;User =sa;Password=123456";
        m_SQLKetNoi = new SqlConnection(m_strChuoiKetNoi);
    }
    public clsKetNoi(string _strSQL)
    {
        m_SQLKetNoi = new SqlConnection(_strSQL);
    }
    public void OpenSQL()
    {
        if (m_SQLKetNoi.State == ConnectionState.Closed)
        {
            m_SQLKetNoi.Open();
        }
    }
    public void CloseSQL()
    {
        if (m_SQLKetNoi.State != ConnectionState.Closed)
        {
            m_SQLKetNoi.Close();
        }
    }
}